import type { devices } from "@/props/device";
import { defineStore } from "pinia";
import { reactive, ref } from "vue";

export const useDeviceStore = defineStore("device",() => {
  const addDeiviceFormVisible = ref(false)

  const dialogDeivce = ref(0)

  const setAddDeiviceFormVisible = () =>{
    addDeiviceFormVisible.value = !addDeiviceFormVisible.value
  }

  const deviceAllData = reactive<devices>([])
  const setDeviceData = (data:{data:devices}) => {
    deviceAllData.splice(0,deviceAllData.length,...data.data)
  }

  return {addDeiviceFormVisible,setAddDeiviceFormVisible, deviceAllData,setDeviceData,dialogDeivce}
})
